<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
<head>
<title>获取文件名及后缀</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<script type="text/javascript">
    var str = 'E:\\luodh\\itcast\\class\\php120912\\js\\day2\\abc.html';
    var hz = str.substring(str.lastIndexOf('.') + 1);
    //alert(hz);
    var wjm = str.substring((str.lastIndexOf('\\') + 1),str.lastIndexOf('.'));
    document.write('文件名为：' + wjm + '<br />');
    document.write('文件后缀为：' + hz);
</script>

<style type="text/css">
</style>
</head>
    <body>
    </body>
</html>